package com.xxwy.ddu.cms.authonrize.impl;

import com.xxwy.ddu.security.code.authonrize.AuthorizeConfigProvider;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.stereotype.Component;

/**
 * @author xxwy
 * on 2018/8/31 0031
 * RdbcAuthorizeConfigProvider 配置的问题
 */
@Component
@Order(Integer.MIN_VALUE+1)
public class RdbcAuthorizeConfigProvider implements AuthorizeConfigProvider {
    @Override
    public boolean config(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
        //读取数据库然后就可以配置了
        config.anyRequest().access("@rbacService.hasPermission(request,authentication)");
        return false;
    }
}
